package com.bawei.mvvmdemo.repository;

import com.bawei.mvvmdemo.entity.BannerEntity;
import com.bawei.mvvmdemo.entity.BaseResponseEntity;
import com.bawei.mvvmdemo.entity.GoodsEntity;
import com.bawei.mvvmdemo.entity.TypeEntity;
import com.bawei.mvvmdemo.net.Api;
import com.bawei.mvvmdemo.net.RetrofitManager;

import java.util.List;

import androidx.lifecycle.LiveData;
import retrofit2.http.GET;
import retrofit2.http.Path;
import retrofit2.http.Query;

/**
 * @Author : yaotianxue
 * @Time : On 2023/9/12 16:40
 * @Description : GoodsRepository 数据仓库：网络请求数据
 */
public class GoodsRepository {
    //构造中初始化Api
    private Api mApi;
    public GoodsRepository() {
        mApi = RetrofitManager.getInstance().getRetrofit().create(Api.class);
    }
    //轮播图
    public LiveData<BaseResponseEntity<BannerEntity>> banner(int type, int page, int pageSize){
        return mApi.banner(type,page,pageSize);
    }
    //分类
    public LiveData<BaseResponseEntity<List<TypeEntity>>> type(int type){
        return mApi.type(type);
    }
    //商品信息
    public LiveData<BaseResponseEntity<GoodsEntity>> goods(int id, int page,  int size){
        return mApi.goods(id,page,size);
    }
}
